function A = prepareA(m, n, h, W)
%PREPAREA Summary of this function goes here
%   Detailed explanation goes here

if nargin == 3
    W = ones(m+2, n+2);
end

ex = ones(m,1);
Ax = spdiags([ex -2*ex ex], -1:1, m, m);
ey = ones(n,1);
Ay = spdiags([ey -2*ey ey], -1:1, n, n);
A = ((kron(speye(n), Ax) + kron(Ay, speye(m))) .* tr2(m, n, W)) ./ (h^2);



